#include "main/utils.h"
using namespace std;

class RecentCount {
  public:
    RecentCount(int window) : window_(window) {};
    int ping(int time) {
      times.push_back(time);
      while (!times.empty() && times.front() < time - window_) {
        times.pop_front();
      }
      return times.size();
    }
  private:
    deque<int> times;
    int window_;
};

int main() {
  RecentCount rc(3000);
  cout << rc.ping(4) << " 1 " << endl;
  cout << rc.ping(10) << " 2 " << endl;
  cout << rc.ping(3000) << " 3 " << endl;
  cout << rc.ping(3005) << " 3 " << endl;
  cout << rc.ping(3010) << " 4 " << endl;
  cout << rc.ping(3011) << " 4 " << endl;

  return 0;
}
